package com.jza04.flightbooking.controller;

import com.jza04.flightbooking.service.FlightService;
import com.jza04.flightbooking.service.PassengerService;
import com.jza04.flightbooking.service.TicketService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

/**
 * 首页控制器
 */
@Controller
public class IndexController {
    
    @Autowired
    private FlightService flightService;
    
    @Autowired
    private PassengerService passengerService;
    
    @Autowired
    private TicketService ticketService;
    
    /**
     * 首页
     */
    @GetMapping("/")
    public String index(Model model) {
        // 加载航班列表
        model.addAttribute("flights", flightService.findAllFlights());
        return "index";
    }
    
    /**
     * 统计面板页面 (旧版)
     */
    @GetMapping("/dashboard")
    public String dashboard(Model model) {
        // 重定向到新的统计面板
        return "redirect:/statistics";
    }
} 